From b9d51015ab983c8ce436fb170461c88ae1507756 Mon Sep 17 00:00:00 2001 From: "kaf24@freefall.cl.cam.ac.uk" Date: Fri, 22 Oct 2004 10:55:47 +0000 Subject: [PATCH] bitkeeper revision 1.1159.1.259 (4178e733n0FQir55loK8zwEyWTnclA) Rename domid field in Xen domain struct. --- xen/arch/x86/domain.c | 4 ++-- xen/arch/x86/idle0_task.c | 2 +- xen/arch/x86/memory.c | 44 ++++++++++++++++++------------------ xen/common/dom0_ops.c | 6 ++--- xen/common/dom_mem_ops.c | 4 ++-- xen/common/domain.c | 20 ++++++++-------- xen/common/event_channel.c | 34 ++++++++++++++-------------- xen/common/grant_table.c | 17 +++++++------- xen/common/keyhandler.c | 2 +- xen/common/page_alloc.c | 2 +- xen/common/physdev.c | 6 ++--- xen/common/sched_atropos.c | 12 +++++----- xen/common/sched_bvt.c | 8 +++---- xen/common/sched_rrobin.c | 2 +- xen/common/schedule.c | 20 ++++++++-------- xen/drivers/char/console.c | 2 +- xen/include/asm-x86/shadow.h | 6 ++--- xen/include/xen/sched.h | 13 +++++++---- 18 files changed, 104 insertions(+), 100 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index f54b0c1fad..af4bffb106 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -90,7 +90,7 @@ void continue_cpu_idle_loop(void) void startup_cpu_idle_loop(void) { /* Just some sanity to ensure that the scheduler is set up okay. */ - ASSERT(current->domain == IDLE_DOMAIN_ID); + ASSERT(current->id == IDLE_DOMAIN_ID); domain_unpause_by_systemcontroller(current); __enter_scheduler(); @@ -595,7 +595,7 @@ int construct_dom0(struct domain *p, extern void physdev_init_dom0(struct domain *); /* Sanity! */ - if ( p->domain != 0 ) + if ( p->id != 0 ) BUG(); if ( test_bit(DF_CONSTRUCTED, &p->flags) ) BUG(); diff --git a/xen/arch/x86/idle0_task.c b/xen/arch/x86/idle0_task.c index 6d85095649..f86722097f 100644 --- a/xen/arch/x86/idle0_task.c +++ b/xen/arch/x86/idle0_task.c @@ -5,7 +5,7 @@ #define IDLE0_TASK(_t) \ { \ processor: 0, \ - domain: IDLE_DOMAIN_ID, \ + id: IDLE_DOMAIN_ID, \ mm: IDLE0_MM, \ thread: INIT_THREAD, \ flags: 1<domain , __LINE__ , ## _a ) + current->id , __LINE__ , ## _a ) #else #define MEM_LOG(_f, _a...) ((void)0) #endif @@ -174,7 +174,7 @@ void arch_init_memory(void) */ dom_xen = alloc_domain_struct(); atomic_set(&dom_xen->refcnt, 1); - dom_xen->domain = DOMID_XEN; + dom_xen->id = DOMID_XEN; /* * Initialise our DOMID_IO domain. @@ -183,7 +183,7 @@ void arch_init_memory(void) */ dom_io = alloc_domain_struct(); atomic_set(&dom_io->refcnt, 1); - dom_io->domain = DOMID_IO; + dom_io->id = DOMID_IO; /* M2P table is mappable read-only by privileged domains. */ for ( mfn = virt_to_phys(&machine_to_phys_mapping[0<<20])>>PAGE_SHIFT; @@ -1071,7 +1071,7 @@ static int do_extended_command(unsigned long ptr, unsigned long val) percpu_info[cpu].foreign = dom_io; break; default: - MEM_LOG("Dom %u cannot set foreign dom\n", d->domain); + MEM_LOG("Dom %u cannot set foreign dom\n", d->id); okay = 0; break; } @@ -1130,7 +1130,7 @@ static int do_extended_command(unsigned long ptr, unsigned long val) { MEM_LOG("Bad page values %08lx: ed=%p(%u), sd=%p," " caf=%08x, taf=%08x\n", page_to_pfn(page), - d, d->domain, nd, x, page->u.inuse.type_info); + d, d->id, nd, x, page->u.inuse.type_info); spin_unlock(&d->page_alloc_lock); put_domain(e); return 0; @@ -1189,7 +1189,7 @@ static int do_extended_command(unsigned long ptr, unsigned long val) case MMUEXT_REASSIGN_PAGE: if ( unlikely(!IS_PRIV(d)) ) { - MEM_LOG("Dom %u has no reassignment priv", d->domain); + MEM_LOG("Dom %u has no reassignment priv", d->id); okay = 0; break; } @@ -1242,7 +1242,7 @@ static int do_extended_command(unsigned long ptr, unsigned long val) { MEM_LOG("Bad page values %08lx: ed=%p(%u), sd=%p," " caf=%08x, taf=%08x\n", page_to_pfn(page), - d, d->domain, nd, x, page->u.inuse.type_info); + d, d->id, nd, x, page->u.inuse.type_info); okay = 0; goto reassign_fail; } @@ -1887,7 +1887,7 @@ void audit_domain(struct domain *d) /* This will only come out once. */ printk("Audit %d: type count whent below zero pfn=%x " "taf=%x otaf=%x\n", - d->domain, page-frame_table, + d->id, page-frame_table, page->u.inuse.type_info, page->tlbflush_timestamp); } @@ -1904,7 +1904,7 @@ void audit_domain(struct domain *d) /* This will only come out once. */ printk("Audit %d: general count whent below zero pfn=%x " "taf=%x otaf=%x\n", - d->domain, page-frame_table, + d->id, page-frame_table, page->u.inuse.type_info, page->tlbflush_timestamp); } @@ -1937,7 +1937,7 @@ void audit_domain(struct domain *d) if ( (pt[i] & _PAGE_PRESENT) && ((pt[i] >> PAGE_SHIFT) == xpfn) ) printk(" found dom=%d i=%x pfn=%lx t=%x c=%x\n", - d->domain, i, pfn, page->u.inuse.type_info, + d->id, i, pfn, page->u.inuse.type_info, page->count_info); unmap_domain_mem(pt); } @@ -2032,11 +2032,11 @@ void audit_domain(struct domain *d) if ( (page->u.inuse.type_info & PGT_validated) != PGT_validated ) printk("Audit %d: L2 not validated %x\n", - d->domain, page->u.inuse.type_info); + d->id, page->u.inuse.type_info); if ( (page->u.inuse.type_info & PGT_pinned) != PGT_pinned ) printk("Audit %d: L2 not pinned %x\n", - d->domain, page->u.inuse.type_info); + d->id, page->u.inuse.type_info); else adjust( page, -1, 1 ); @@ -2059,14 +2059,14 @@ void audit_domain(struct domain *d) if ( (l1page->u.inuse.type_info & PGT_type_mask) == PGT_l2_page_table ) printk("Audit %d: [%x] Found %s Linear PT " - "t=%x pfn=%lx\n", d->domain, i, + "t=%x pfn=%lx\n", d->id, i, (l1pfn==pfn) ? "Self" : "Other", l1page->u.inuse.type_info, l1pfn); else if ( (l1page->u.inuse.type_info & PGT_type_mask) != PGT_l1_page_table ) printk("Audit %d: [%x] Expected L1 t=%x pfn=%lx\n", - d->domain, i, + d->id, i, l1page->u.inuse.type_info, l1pfn); @@ -2086,11 +2086,11 @@ void audit_domain(struct domain *d) if ( (page->u.inuse.type_info & PGT_validated) != PGT_validated ) printk("Audit %d: L1 not validated %x\n", - d->domain, page->u.inuse.type_info); + d->id, page->u.inuse.type_info); #if 0 if ( (page->u.inuse.type_info & PGT_pinned) != PGT_pinned ) printk("Audit %d: L1 not pinned %x\n", - d->domain, page->u.inuse.type_info); + d->id, page->u.inuse.type_info); #endif pt = map_domain_mem( pfn<u.inuse.type_info & PGT_type_mask) == PGT_l2_page_table ) printk("Audit %d: [%x] Ilegal RW t=%x pfn=%lx\n", - d->domain, i, + d->id, i, l1page->u.inuse.type_info, l1pfn); @@ -2131,7 +2131,7 @@ void audit_domain(struct domain *d) { printk("Audit %d: [%lx,%x] Skip foreign page dom=%lx " "pfn=%lx c=%08x t=%08x m2p=%lx\n", - d->domain, pfn, i, + d->id, pfn, i, (unsigned long)l1page->u.inuse.domain, l1pfn, l1page->count_info, @@ -2154,7 +2154,7 @@ void audit_domain(struct domain *d) if ( (io_mappings > 0) || (lowmem_mappings > 0) ) printk("Audit %d: Found %d lowmem mappings and %d io mappings\n", - d->domain, lowmem_mappings, io_mappings); + d->id, lowmem_mappings, io_mappings); /* PHASE 2 */ @@ -2172,7 +2172,7 @@ void audit_domain(struct domain *d) if ( (page->u.inuse.type_info & PGT_count_mask) != 0 ) { printk("Audit %d: type count!=0 t=%x ot=%x c=%x pfn=%lx\n", - d->domain, page->u.inuse.type_info, + d->id, page->u.inuse.type_info, page->tlbflush_timestamp, page->count_info, pfn ); scan_for_pfn_remote(pfn); @@ -2181,7 +2181,7 @@ void audit_domain(struct domain *d) if ( (page->count_info & PGC_count_mask) != 1 ) { printk("Audit %d: gen count!=1 (c=%x) t=%x ot=%x pfn=%lx\n", - d->domain, + d->id, page->count_info, page->u.inuse.type_info, page->tlbflush_timestamp, pfn ); @@ -2260,7 +2260,7 @@ void audit_domain(struct domain *d) adjust(&frame_table[pagetable_val(d->mm.pagetable)>>PAGE_SHIFT], 1, 1); - printk("Audit %d: Done. ctot=%d ttot=%d\n",d->domain, ctot, ttot ); + printk("Audit %d: Done. ctot=%d ttot=%d\n", d->id, ctot, ttot ); if ( d != current ) domain_unpause(d); diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c index ed2785a0ea..75de00b69d 100644 --- a/xen/common/dom0_ops.c +++ b/xen/common/dom0_ops.c @@ -218,7 +218,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) ret = 0; - op->u.createdomain.domain = d->domain; + op->u.createdomain.domain = d->id; copy_to_user(u_dom0_op, op, sizeof(*op)); } break; @@ -340,7 +340,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) for_each_domain ( d ) { - if ( d->domain >= op->u.getdomaininfo.domain ) + if ( d->id >= op->u.getdomaininfo.domain ) break; } @@ -353,7 +353,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op) read_unlock_irqrestore(&tasklist_lock, flags); - op->u.getdomaininfo.domain = d->domain; + op->u.getdomaininfo.domain = d->id; op->u.getdomaininfo.flags = (test_bit(DF_DYING, &d->flags) ? DOMFLAGS_DYING : 0) | diff --git a/xen/common/dom_mem_ops.c b/xen/common/dom_mem_ops.c index a4ce55bbc0..2169fad2a1 100644 --- a/xen/common/dom_mem_ops.c +++ b/xen/common/dom_mem_ops.c @@ -71,14 +71,14 @@ static long free_dom_mem(struct domain *d, if ( unlikely((mpfn + j) >= max_page) ) { DPRINTK("Domain %u page number out of range (%08lx>=%08lx)\n", - d->domain, mpfn + j, max_page); + d->id, mpfn + j, max_page); return i; } page = &frame_table[mpfn + j]; if ( unlikely(!get_page(page, d)) ) { - DPRINTK("Bad page free for domain %u\n", d->domain); + DPRINTK("Bad page free for domain %u\n", d->id); return i; } diff --git a/xen/common/domain.c b/xen/common/domain.c index 99039c10df..aa95d48ba6 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -35,8 +35,8 @@ struct domain *do_createdomain(domid_t dom_id, unsigned int cpu) shadow_lock_init(d); - d->domain = dom_id; - d->processor = cpu; + d->id = dom_id; + d->processor = cpu; d->create_time = NOW(); memcpy(&d->thread, &idle0_task.thread, sizeof(d->thread)); @@ -49,7 +49,7 @@ struct domain *do_createdomain(domid_t dom_id, unsigned int cpu) spin_lock_init(&d->pcidev_lock); INIT_LIST_HEAD(&d->pcidev_list); - if ( d->domain != IDLE_DOMAIN_ID ) + if ( d->id != IDLE_DOMAIN_ID ) { if ( (init_event_channels(d) != 0) || (grant_table_create(d) != 0) ) { @@ -65,7 +65,7 @@ struct domain *do_createdomain(domid_t dom_id, unsigned int cpu) write_lock_irqsave(&tasklist_lock, flags); pd = &task_list; /* NB. task_list is maintained in order of dom_id. */ for ( pd = &task_list; *pd != NULL; pd = &(*pd)->next_list ) - if ( (*pd)->domain > d->domain ) + if ( (*pd)->id > d->id ) break; d->next_list = *pd; *pd = d; @@ -91,7 +91,7 @@ struct domain *find_domain_by_id(domid_t dom) d = task_hash[TASK_HASH(dom)]; while ( d != NULL ) { - if ( d->domain == dom ) + if ( d->id == dom ) { if ( unlikely(!get_domain(d)) ) d = NULL; @@ -144,7 +144,7 @@ void domain_crash(void) { struct domain *d; - if ( current->domain == 0 ) + if ( current->id == 0 ) BUG(); set_bit(DF_CRASHED, ¤t->flags); @@ -161,7 +161,7 @@ void domain_shutdown(u8 reason) { struct domain *d; - if ( current->domain == 0 ) + if ( current->id == 0 ) { extern void machine_restart(char *); extern void machine_halt(void); @@ -212,7 +212,7 @@ unsigned int alloc_new_dom_mem(struct domain *d, unsigned int kbytes) { /* Initialise with magic marker if in DEBUG mode. */ void *a = map_domain_mem((page-frame_table)<domain, PAGE_SIZE); + memset(a, 0x80 | (char)d->id, PAGE_SIZE); unmap_domain_mem(a); } #endif @@ -239,7 +239,7 @@ void domain_destruct(struct domain *d) if ( _atomic_read(old) != 0 ) return; - DPRINTK("Releasing task %u\n", d->domain); + DPRINTK("Releasing task %u\n", d->id); /* Delete from task list and task hashtable. */ write_lock_irqsave(&tasklist_lock, flags); @@ -247,7 +247,7 @@ void domain_destruct(struct domain *d) while ( *pd != d ) pd = &(*pd)->next_list; *pd = d->next_list; - pd = &task_hash[TASK_HASH(d->domain)]; + pd = &task_hash[TASK_HASH(d->id)]; while ( *pd != d ) pd = &(*pd)->next_hash; *pd = d->next_hash; diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index 4df98a07d7..5a0e1fbf25 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -78,9 +78,9 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind) return -EPERM; if ( dom1 == DOMID_SELF ) - dom1 = current->domain; + dom1 = current->id; if ( dom2 == DOMID_SELF ) - dom2 = current->domain; + dom2 = current->id; if ( ((d1 = find_domain_by_id(dom1)) == NULL) || ((d2 = find_domain_by_id(dom2)) == NULL) ) @@ -119,12 +119,12 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind) goto out; } - d1->event_channel[port1].u.remote.dom = d2; - d1->event_channel[port1].u.remote.port = (u16)port2; + d1->event_channel[port1].u.interdomain.remote_dom = d2; + d1->event_channel[port1].u.interdomain.remote_port = (u16)port2; - d2->event_channel[port2].u.remote.dom = d1; - d2->event_channel[port2].u.remote.port = (u16)port1; - d2->event_channel[port2].state = ECS_INTERDOMAIN; + d2->event_channel[port2].u.interdomain.remote_dom = d1; + d2->event_channel[port2].u.interdomain.remote_port = (u16)port1; + d2->event_channel[port2].state = ECS_INTERDOMAIN; out: spin_unlock(&d1->event_channel_lock); @@ -254,7 +254,7 @@ static long __evtchn_close(struct domain *d1, int port1) case ECS_INTERDOMAIN: if ( d2 == NULL ) { - d2 = chn1[port1].u.remote.dom; + d2 = chn1[port1].u.interdomain.remote_dom; /* If we unlock d1 then we could lose d2. Must get a reference. */ if ( unlikely(!get_domain(d2)) ) @@ -278,20 +278,20 @@ static long __evtchn_close(struct domain *d1, int port1) goto again; } } - else if ( d2 != chn1[port1].u.remote.dom ) + else if ( d2 != chn1[port1].u.interdomain.remote_dom ) { rc = -EINVAL; goto out; } chn2 = d2->event_channel; - port2 = chn1[port1].u.remote.port; + port2 = chn1[port1].u.interdomain.remote_port; if ( port2 >= d2->max_event_channel ) BUG(); if ( chn2[port2].state != ECS_INTERDOMAIN ) BUG(); - if ( chn2[port2].u.remote.dom != d1 ) + if ( chn2[port2].u.interdomain.remote_dom != d1 ) BUG(); chn2[port2].state = ECS_UNBOUND; @@ -324,7 +324,7 @@ static long evtchn_close(evtchn_close_t *close) domid_t dom = close->dom; if ( dom == DOMID_SELF ) - dom = current->domain; + dom = current->id; else if ( !IS_PRIV(current) ) return -EPERM; @@ -353,8 +353,8 @@ static long evtchn_send(int lport) return -EINVAL; } - rd = ld->event_channel[lport].u.remote.dom; - rport = ld->event_channel[lport].u.remote.port; + rd = ld->event_channel[lport].u.interdomain.remote_dom; + rport = ld->event_channel[lport].u.interdomain.remote_port; evtchn_set_pending(rd, rport); @@ -373,7 +373,7 @@ static long evtchn_status(evtchn_status_t *status) long rc = 0; if ( dom == DOMID_SELF ) - dom = current->domain; + dom = current->id; else if ( !IS_PRIV(current) ) return -EPERM; @@ -400,8 +400,8 @@ static long evtchn_status(evtchn_status_t *status) break; case ECS_INTERDOMAIN: status->status = EVTCHNSTAT_interdomain; - status->u.interdomain.dom = chn[port].u.remote.dom->domain; - status->u.interdomain.port = chn[port].u.remote.port; + status->u.interdomain.dom = chn[port].u.interdomain.remote_dom->id; + status->u.interdomain.port = chn[port].u.interdomain.remote_port; break; case ECS_PIRQ: status->status = EVTCHNSTAT_pirq; diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index c40f0a5ed8..2c948b7433 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -128,10 +128,10 @@ __gnttab_map_grant_ref( u32 scombo, prev_scombo, new_scombo; if ( unlikely((sflags & GTF_type_mask) != GTF_permit_access) || - unlikely(sdom != ld->domain) ) + unlikely(sdom != ld->id) ) PIN_FAIL(GNTST_general_error, "Bad flags (%x) or dom (%d). (NB. expected dom %d)\n", - sflags, sdom, ld->domain); + sflags, sdom, ld->id); /* Merge two 16-bit values into a 32-bit combined update. */ /* NB. Endianness! */ @@ -404,7 +404,7 @@ gnttab_setup_table( if ( op.dom == DOMID_SELF ) { - op.dom = current->domain; + op.dom = current->id; } else if ( unlikely(!IS_PRIV(current)) ) { @@ -486,7 +486,7 @@ gnttab_prepare_for_transfer( if ( unlikely((t = rd->grant_table) == NULL) || unlikely(ref >= NR_GRANT_ENTRIES) ) { - DPRINTK("Dom %d has no g.t., or ref is bad (%d).\n", rd->domain, ref); + DPRINTK("Dom %d has no g.t., or ref is bad (%d).\n", rd->id, ref); return 0; } @@ -500,10 +500,10 @@ gnttab_prepare_for_transfer( for ( ; ; ) { if ( unlikely(sflags != GTF_accept_transfer) || - unlikely(sdom != ld->domain) ) + unlikely(sdom != ld->id) ) { DPRINTK("Bad flags (%x) or dom (%d). (NB. expected dom %d)\n", - sflags, sdom, ld->domain); + sflags, sdom, ld->id); goto fail; } @@ -565,10 +565,11 @@ grant_table_create( memset(t, 0, sizeof(*t)); spin_lock_init(&t->lock); - /* Active grant-table page. */ + /* Active grant table. */ if ( (t->active = xmalloc(sizeof(active_grant_entry_t) * NR_GRANT_ENTRIES)) == NULL ) goto no_mem; + memset(t->active, 0, sizeof(active_grant_entry_t) * NR_GRANT_ENTRIES); if ( (t->maptrack = (void *)alloc_xenheap_page()) == NULL ) goto no_mem; @@ -576,7 +577,7 @@ grant_table_create( for ( i = 0; i < NR_MAPTRACK_ENTRIES; i++ ) t->maptrack[i].ref_and_flags = (i+1) << MAPTRACK_REF_SHIFT; - /* Set up shared grant-table page. */ + /* Shared grant table. */ if ( (t->shared = (void *)alloc_xenheap_page()) == NULL ) goto no_mem; memset(t->shared, 0, PAGE_SIZE); diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index e0fe960549..48860e43c9 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -72,7 +72,7 @@ void do_task_queues(unsigned char key, void *dev_id, { printk("Xen: DOM %u, CPU %d [has=%c] flags=%lx refcnt=%d nr_pages=%d " "xenheap_pages=%d\n", - d->domain, d->processor, + d->id, d->processor, test_bit(DF_RUNNING, &d->flags) ? 'T':'F', d->flags, atomic_read(&d->refcnt), d->tot_pages, d->xenheap_pages); diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index f9b0da6304..0abd061bd4 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -398,7 +398,7 @@ struct pfn_info *alloc_domheap_pages(struct domain *d, int order) unlikely((d->tot_pages + (1 << order)) > d->max_pages) ) { DPRINTK("Over-allocation for domain %u: %u > %u\n", - d->domain, d->tot_pages + (1 << order), d->max_pages); + d->id, d->tot_pages + (1 << order), d->max_pages); DPRINTK("...or the domain is dying (%d)\n", !!test_bit(DF_DYING, &d->flags)); spin_unlock(&d->page_alloc_lock); diff --git a/xen/common/physdev.c b/xen/common/physdev.c index 41218753ee..ff486ba29b 100644 --- a/xen/common/physdev.c +++ b/xen/common/physdev.c @@ -220,7 +220,7 @@ int domain_iomem_in_pfn(struct domain *p, unsigned long pfn) struct list_head *l; VERBOSE_INFO("Checking if physdev-capable domain %u needs access to " - "pfn %08lx\n", p->domain, pfn); + "pfn %08lx\n", p->id, pfn); spin_lock(&p->pcidev_lock); @@ -248,7 +248,7 @@ int domain_iomem_in_pfn(struct domain *p, unsigned long pfn) spin_unlock(&p->pcidev_lock); VERBOSE_INFO("Domain %u %s mapping of pfn %08lx\n", - p->domain, ret ? "allowed" : "disallowed", pfn); + p->id, ret ? "allowed" : "disallowed", pfn); return ret; } @@ -331,7 +331,7 @@ static int do_base_address_access(phys_dev_t *pdev, int acc, int idx, * anyway if this write fails. Hopefully the printk will give us a * clue what went wrong. */ INFO("Guest %u attempting sub-dword %s to BASE_ADDRESS %d\n", - pdev->owner->domain, (acc == ACC_READ) ? "read" : "write", idx); + pdev->owner->id, (acc == ACC_READ) ? "read" : "write", idx); return -EPERM; } diff --git a/xen/common/sched_atropos.c b/xen/common/sched_atropos.c index 70fd02682f..b83d853d5d 100644 --- a/xen/common/sched_atropos.c +++ b/xen/common/sched_atropos.c @@ -212,7 +212,7 @@ static void at_add_task(struct domain *p) p->lastschd = now; /* DOM 0's parameters must be set here for it to boot the system! */ - if(p->domain == 0) + if(p->id == 0) { DOM_INFO(p)->remain = MILLISECS(15); DOM_INFO(p)->nat_period = @@ -250,7 +250,7 @@ static void dequeue(struct domain *sdom) { struct at_dom_info *inf = DOM_INFO(sdom); - ASSERT(sdom->domain != IDLE_DOMAIN_ID); + ASSERT(sdom->id != IDLE_DOMAIN_ID); /* just delete it from all the queues! */ list_del(&inf->waitq); @@ -482,7 +482,7 @@ deschedule_done: /* MAW - the idle domain is always on the run queue. We run from the * runqueue if it's NOT the idle domain or if there's nothing on the wait * queue */ - if (cur_sdom->domain == IDLE_DOMAIN_ID && !list_empty(WAITQ(cpu))) + if (cur_sdom->id == IDLE_DOMAIN_ID && !list_empty(WAITQ(cpu))) { struct list_head *item; @@ -564,7 +564,7 @@ deschedule_done: ret.task = cur_sdom; ret.time = newtime - time; - TRACE_1D(0, cur_sdom->domain); + TRACE_1D(0, cur_sdom->id); return ret; } @@ -616,7 +616,7 @@ static void at_dump_cpu_state(int cpu) { d_inf = list_entry(list, struct at_dom_info, run_list); d = d_inf->owner; - printk("%3d: %d has=%c ", loop++, d->domain, + printk("%3d: %d has=%c ", loop++, d->id, test_bit(DF_RUNNING, &d->flags) ? 'T':'F'); at_dump_runq_el(d); printk("c=0x%X%08X\n", (u32)(d->cpu_time>>32), (u32)d->cpu_time); @@ -634,7 +634,7 @@ static void at_dump_cpu_state(int cpu) { d_inf = list_entry(list, struct at_dom_info, waitq); d = d_inf->owner; - printk("%3d: %d has=%c ", loop++, d->domain, + printk("%3d: %d has=%c ", loop++, d->id, test_bit(DF_RUNNING, &d->flags) ? 'T':'F'); at_dump_runq_el(d); printk("c=0x%X%08X\n", (u32)(d->cpu_time>>32), (u32)d->cpu_time); diff --git a/xen/common/sched_bvt.c b/xen/common/sched_bvt.c index 46e374a2c4..5a1df7fee4 100644 --- a/xen/common/sched_bvt.c +++ b/xen/common/sched_bvt.c @@ -194,7 +194,7 @@ void bvt_add_task(struct domain *d) inf->unwarp_timer.data = (unsigned long)inf; inf->unwarp_timer.function = &unwarp_timer_fn; - if ( d->domain == IDLE_DOMAIN_ID ) + if ( d->id == IDLE_DOMAIN_ID ) { inf->avt = inf->evt = ~0U; } @@ -308,7 +308,7 @@ int bvt_adjdom( DPRINTK("Get domain %u bvt mcu_adv=%u, warpback=%d, warpvalue=%d, " "warpl=%lld, warpu=%lld\n", - d->domain, inf->mcu_advance, inf->warpback, inf->warp_value, + d->id, inf->mcu_advance, inf->warpback, inf->warp_value, inf->warpl, inf->warpu); /* Sanity -- this can avoid divide-by-zero. */ @@ -331,7 +331,7 @@ int bvt_adjdom( DPRINTK("Get domain %u bvt mcu_adv=%u, warpback=%d, warpvalue=%d, " "warpl=%lld, warpu=%lld\n", - d->domain, inf->mcu_advance, inf->warpback, inf->warp_value, + d->id, inf->mcu_advance, inf->warpback, inf->warp_value, inf->warpl, inf->warpu); } @@ -531,7 +531,7 @@ static void bvt_dump_cpu_state(int i) { d_inf = list_entry(list, struct bvt_dom_info, run_list); d = d_inf->domain; - printk("%3d: %u has=%c ", loop++, d->domain, + printk("%3d: %u has=%c ", loop++, d->id, test_bit(DF_RUNNING, &d->flags) ? 'T':'F'); bvt_dump_runq_el(d); printk("c=0x%X%08X\n", (u32)(d->cpu_time>>32), (u32)d->cpu_time); diff --git a/xen/common/sched_rrobin.c b/xen/common/sched_rrobin.c index 18f5ce3c64..1915b37632 100644 --- a/xen/common/sched_rrobin.c +++ b/xen/common/sched_rrobin.c @@ -180,7 +180,7 @@ void rr_wake(struct domain *d) static void rr_dump_domain(struct domain *d) { - printk("%u has=%c ", d->domain, + printk("%u has=%c ", d->id, test_bit(DF_RUNNING, &d->flags) ? 'T':'F'); printk("c=0x%X%08X\n", (u32)(d->cpu_time>>32), (u32)d->cpu_time); } diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 032f1bd271..7b7530616c 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -127,7 +127,7 @@ void sched_add_domain(struct domain *d) /* Must be unpaused by control software to start execution. */ set_bit(DF_CTRLPAUSE, &d->flags); - if ( d->domain != IDLE_DOMAIN_ID ) + if ( d->id != IDLE_DOMAIN_ID ) { /* Initialise the per-domain timer. */ init_ac_timer(&d->timer); @@ -142,14 +142,14 @@ void sched_add_domain(struct domain *d) SCHED_OP(add_task, d); - TRACE_2D(TRC_SCHED_DOM_ADD, d->domain, d); + TRACE_2D(TRC_SCHED_DOM_ADD, d->id, d); } void sched_rem_domain(struct domain *d) { rem_ac_timer(&d->timer); SCHED_OP(rem_task, d); - TRACE_2D(TRC_SCHED_DOM_REM, d->domain, d); + TRACE_2D(TRC_SCHED_DOM_REM, d->id, d); } void init_idle_task(void) @@ -185,7 +185,7 @@ void domain_wake(struct domain *d) if ( likely(domain_runnable(d)) ) { - TRACE_2D(TRC_SCHED_WAKE, d->domain, d); + TRACE_2D(TRC_SCHED_WAKE, d->id, d); SCHED_OP(wake, d); #ifdef WAKE_HISTO d->wokenup = NOW(); @@ -200,10 +200,10 @@ void domain_wake(struct domain *d) /* Block the currently-executing domain until a pertinent event occurs. */ long do_block(void) { - ASSERT(current->domain != IDLE_DOMAIN_ID); + ASSERT(current->id != IDLE_DOMAIN_ID); current->shared_info->vcpu_data[0].evtchn_upcall_mask = 0; set_bit(DF_BLOCKED, ¤t->flags); - TRACE_2D(TRC_SCHED_BLOCK, current->domain, current); + TRACE_2D(TRC_SCHED_BLOCK, current->id, current); __enter_scheduler(); return 0; } @@ -211,7 +211,7 @@ long do_block(void) /* Voluntarily yield the processor for this allocation. */ static long do_yield(void) { - TRACE_2D(TRC_SCHED_YIELD, current->domain, current); + TRACE_2D(TRC_SCHED_YIELD, current->id, current); __enter_scheduler(); return 0; } @@ -264,7 +264,7 @@ long do_set_timer_op(unsigned long timeout_hi, unsigned long timeout_lo) add_ac_timer(&p->timer); } - TRACE_4D(TRC_SCHED_SET_TIMER, p->domain, p, timeout_hi, timeout_lo); + TRACE_4D(TRC_SCHED_SET_TIMER, p->id, p, timeout_hi, timeout_lo); return 0; } @@ -301,7 +301,7 @@ long sched_adjdom(struct sched_adjdom_cmd *cmd) if ( d == NULL ) return -ESRCH; - TRACE_1D(TRC_SCHED_ADJDOM, d->domain); + TRACE_1D(TRC_SCHED_ADJDOM, d->id); spin_lock_irq(&schedule_data[d->processor].schedule_lock); SCHED_OP(adjdom, d, cmd); @@ -394,7 +394,7 @@ void __enter_scheduler(void) } #endif - TRACE_2D(TRC_SCHED_SWITCH, next->domain, next); + TRACE_2D(TRC_SCHED_SWITCH, next->id, next); switch_to(prev, next); diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 09f7ab0307..350cf09cbd 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -294,7 +294,7 @@ long do_console_io(int cmd, int count, char *buffer) #ifndef VERBOSE /* Only domain-0 may access the emergency console. */ - if ( current->domain != 0 ) + if ( current->id != 0 ) return -EPERM; #endif diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index ac0f654fd0..b28e7dfdf1 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -62,7 +62,7 @@ struct shadow_status { #ifdef VERBOSE #define SH_LOG(_f, _a...) \ printk("DOM%u: (file=shadow.c, line=%d) " _f "\n", \ - current->domain , __LINE__ , ## _a ) + current->id , __LINE__ , ## _a ) #else #define SH_LOG(_f, _a...) #endif @@ -70,7 +70,7 @@ printk("DOM%u: (file=shadow.c, line=%d) " _f "\n", \ #if SHADOW_DEBUG #define SH_VLOG(_f, _a...) \ printk("DOM%u: (file=shadow.c, line=%d) " _f "\n", \ - current->domain , __LINE__ , ## _a ) + current->id , __LINE__ , ## _a ) #else #define SH_VLOG(_f, _a...) #endif @@ -78,7 +78,7 @@ printk("DOM%u: (file=shadow.c, line=%d) " _f "\n", \ #if 0 #define SH_VVLOG(_f, _a...) \ printk("DOM%u: (file=shadow.c, line=%d) " _f "\n", \ - current->domain , __LINE__ , ## _a ) + current->id , __LINE__ , ## _a ) #else #define SH_VVLOG(_f, _a...) #endif diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index a5647c56ce..7c1e7bc909 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -29,16 +29,19 @@ struct domain; typedef struct event_channel_st { #define ECS_FREE 0 /* Channel is available for use. */ -#define ECS_UNBOUND 1 /* Channel is not bound to a particular source. */ +#define ECS_UNBOUND 1 /* Channel is waiting to bind to a remote domain. */ #define ECS_INTERDOMAIN 2 /* Channel is bound to another domain. */ #define ECS_PIRQ 3 /* Channel is bound to a physical IRQ line. */ #define ECS_VIRQ 4 /* Channel is bound to a virtual IRQ line. */ u16 state; union { struct { - u16 port; - struct domain *dom; - } __attribute__ ((packed)) remote; /* state == ECS_CONNECTED */ + domid_t remote_domid; + } __attribute__ ((packed)) unbound; /* state == ECS_UNBOUND */ + struct { + u16 remote_port; + struct domain *remote_dom; + } __attribute__ ((packed)) interdomain; /* state == ECS_INTERDOMAIN */ u16 pirq; /* state == ECS_PIRQ */ u16 virq; /* state == ECS_VIRQ */ } u; @@ -83,7 +86,7 @@ struct domain * From here on things can be added and shuffled without special attention */ - domid_t domain; + domid_t id; s_time_t create_time; spinlock_t page_alloc_lock; /* protects all the following fields */ -- 2.30.2